import http from '@/api/http.js'
export default async function(str, urlArr = []) {
	let params, infoRes, path;
	return new Promise(async resolve => {
		// #ifdef MP-WEIXIN
		path = 'data:video/mp4;base64,' + wx.getFileSystemManager().readFileSync(str, 'base64');
		// #endif
		// #ifdef MP-TOUTIAO
		path = 'data:video/mp4;base64,' + tt.getFileSystemManager().readFileSync(str, 'base64');
		// #endif
		// #ifdef H5
		path = str
		// #endif
		// #ifdef MP-ALIPAY
		path = str
		// #endif
		// console.log(path)
		// return
		params = {
			method: "api/v2/common/upload_video",
			str: path
		}
		infoRes = await http(params);
		if (infoRes.status) {
			resolve(infoRes.data.url)
			uni.setStorageSync('video_tem_path', infoRes.data.url)
			setTimeout(() => {
				uni.hideLoading()
			}, 500)
		} else {
			uni.showToast({
				title: infoRes.msg,
				icon: "none"
			})
		}
	})
}